import React, { PureComponent, Fragment } from 'react';
import { connect } from 'dva';
import router from 'umi/router';
import { Row, Col, Card, Icon, Button} from 'antd';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import DetailInfo from "./Components/DetailInfo";
import ServiceEquipment from "./Components/ServiceEquipment";
import styles from '../Pbulic.less';


@connect()
export default class EquipmentDetail extends PureComponent {
  constructor(props) {
    super(props);

  }


  componentDidMount() {

  }

  componentWillUnmount(){
    const { dispatch } = this.props;
    dispatch({
      type: `equipment_maintain/appendClearState`,
    })
  }

  goBack = () => {
    // this.props.onClose(0);
    const { dispatch, location } = this.props;
    router.push({ pathname:'/equipment/maintenance/list',  query: { ...location.query} });
  }

  render() {
    const { match } = this.props;
    const detailInfoId = match.params.id;


    return (
      <Fragment>
        <Icon type="close-circle-o"  className={styles.close_icon} onClick={this.goBack}/>
        <PageHeaderLayout
          hiddenBreadcurmb={true}
          title={`维保单位详情`}
        >
          <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
            <Col md={8} sm={24}>
              <Card title={"维保单位信息"}>
                <DetailInfo detailInfoId={detailInfoId} />
              </Card>
            </Col>
            <Col md={16} sm={24}>
              <Card
                title={"维保服务设备清单"}
                bodyStyle={{padding:'1px 0 0 0'}}
              >
                <ServiceEquipment  detailInfoId={detailInfoId}  />
              </Card>
            </Col>
          </Row>

        </PageHeaderLayout>
      </Fragment>
    );
  }
}
